{extend name="pc/admin/layout"/}
{block name="main"}
   <div class="g-1400 g-container" id="pjax-container">
        
<div class="bg-bai b rx3" id="vue-page">
<form id="form-config">
    <div class="t-v t-t">
        <div class="c-sidebar c-sidebar-h pb5 br">
            <div class="c-sidebar-title t-v hui bb">网站数据管理</div>
            <ul class="c-nav click-nav">
				<li class="active"><a href="{:url('pc/admin',['act'=>'data','s'=>'user_list'])}" class="t-v" data-pjax>
                    <div><i class="icon icon-form"></i></div>
                    <div>用户列表</div>
                </a></li>
				<li><a href="{:url('pc/admin',['act'=>'data','s'=>'qq_list'])}" class="t-v" data-pjax>
                    <div><i class="icon icon-form"></i></div>
                    <div>QQ列表</div>
                </a></li>
				<li><a href="{:url('pc/admin',['act'=>'data','s'=>'gg_list'])}" class="t-v" data-pjax>
                    <div><i class="icon icon-form"></i></div>
                    <div>公告列表</div>
                </a></li>
				<li><a href="{:url('pc/admin',['act'=>'data','s'=>'fz_list'])}" class="t-v" data-pjax>
                    <div><i class="icon icon-form"></i></div>
                    <div>分站列表</div>
                </a></li>
            </ul>
        </div>
<div class="c-content bl">
            <div class="g-title t-v pl4 bb">
				<div class="col-8 h t-v bold">用户列表</div>
				<div class="col-4 t-v t-r">
                    <div class="g-search in-text w22 b b-hui mr5">
                        <dd><input type="text" class="form form-md pl4 pr4" v-model="search.uid" placeholder="输入用户UID进行搜索" value=""></dd>
                        <dt>
                            <button type="button" class="btn btn-bai btn-md pl5 pr6 bl" @click="search.page=1;loadList()"><i class="icon icon-search"></i></button>
                        </dt>
                    </div>
                </div>
			</div>
                <table class="table table-hover">
                    <thead>
                    <th>UID</th>
                    <th>昵称</th>
                    <th>注册IP</th>
                    <th>注册时间</th>
                    <th>操作</th>
                    </thead>
                    <tbody>
                    <tr v-for="row in list" >
                        <td>{{row.uid}}</td>
                        <td>{{row.nickname}}</td>
                        <td>{{row.regip}}</td>
                        <td>{{row.regtime}}</td>
                        <td>
                            <a :href="'{:url('pc/admin',['act'=>'edit','s'=>'user'])}?uid='+row.uid" data-pjax>修改</a> 
							
							<a @click="delUser(row.uid)">删除</a>
                        </td>
                    </tr>
                    </tbody>
                </table>
        </div>
</div>
</form>
<div class="c-pagination o-h t-v">
        <div class="c-sidebar"></div>
        <div class="c-content h11 o-h g-btn t-v bt bl">
		<div class="col-12 h no g-btn g-minhide t-v t-r">
			<pagination ref="pagination" :total="total" :current_page="search.page" :page_size="search.pageSize"
                            @page-phange="pageChange"></pagination>
        </div>
		</div>
    </div>
</div>

    </div>
   {/block}
   {block name='foot'}
		<script>
        new Vue({
            el: '#vue-page',
            data: {
                search: {
                    page: 1,
                    pageSize: 10,
                    uid: null,
                    type:'',
                },
                total: 0,
                list: []
            },
            methods: {
                pageChange: function (p) {
                    this.search.page = p;
                    this.loadList();
                },
                loadList: function () {
                    this.$refs.pagination.setCurrent(this.search.page);// 改变页码
                    var vue = this;
                    app.ajax("{:url('AdminAjax/userList',['action'=>'list'])}", this.search, function (data) {
                        if (data.code === 0) {
                            vue.total = data.total;
                            vue.list = data.list;
                        } else {
                            x.msg(data.message);
                        }
                    })
                },
                delUser: function (id) {
                    if (!confirm('确认要删除此用户？')) return;
                    var vue = this;
                    app.ajax("{:url('AdminAjax/userList',['action'=>'del'])}", {id: id}, function (data) {
                        if (data.code === 0) {
                            vue.loadList();
                            x.msg(data.message)
                        } else {
                            x.msg(data.message)
                        }
                    },'',false)
                },
            },
            mounted: function () {
                this.loadList();
            }
        })
    </script>
    {/block}